﻿
<!Doctype html>
<html xmlns="http://www.w3.org/1999/html">
<!---------------------------------------------------------
Auther:：Fin;  Version：Autotestplat-V3.0
----------------------------------------------------------->
<head>
    <meta charset="UTF-8">
    <title> 性能测试 </title>
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/css/fileinput.min.css">
{#    <link rel="stylesheet" href="/static/css/style.css" type="text/css">#}
    <link href="/static/dist/css/style.css" rel="stylesheet" type="text/css">
    <link href="/static/css/dt.css" rel="stylesheet" type="text/css">
    <link href="/static/css/navbar.css" rel="stylesheet" type="text/css">
    <script src="/static/vendors/jquery/dist/jquery.min.js" type="text/javascript"></script>
    <script src="/static/vendors/popper.js/dist/umd/popper.min.js"></script>
    <script src="/static/src/localfiles/bootstrap.min.js"></script>
    <script src="/static/src/localfiles/jquery.dataTables.min.js"></script>
    <script src="/static/src/localfiles/dataTables.bootstrap4.min.js"></script>
    <script src="/static/vendors/laydate/laydate.js" type="text/javascript"></script>
    <script src="/static/js/public.js"></script>
    <script src="/static/js/performance.js"></script>
    <script>
        window.onload = function(){
            if(loginVerify() == 200){
            }
            var selectElement = document.getElementById('select-option');
            var options = selectElement.options;
            for (var i = 0; i < options.length; i++) {
                if (options[i].text === "{{ product_name }}") {
                    options[i].style.display = 'none';
                    break;
                }
            }
        }
    </script>
</head>
<body>
     <div class="row" >
        <div class="col-sm">
            <ul class="nav nav-pills nav-pills-success nav-pills-square nav-light bg-white pa-15 fixed-top">
                <li class="nav-item">
                    <a href={% url 'product' %} class="nav-link"> 产品管理 </a>
                </li>
                <li class="nav-item">
                    <a href={% url 'apitestcase' %} class="nav-link"> 接口用例 </a>
                </li>
                <li class="nav-item">
                    <a href={% url 'apitestplan' %} class="nav-link"> 测试计划 </a>
                </li>
                <li class="nav-item">
                    <a href={% url 'apireport' %} class="nav-link"> 测试报告 </a>
                </li>
                <li class="nav-item">
                    <a href={% url 'apiperformance' %} class="nav-link active"> 性能测试 </a>
                </li>
                <li class="nav-item dropdown" id="uiDropdown">
                <a id="uitest" class="nav-link"> UI测试 </a>
                <ul class="dropdown-menu" id="uiDropdownMenu">
                    <li><a href={% url 'apptestcase' %} class="nav-link"> AppUI测试 </a></li>
                    <li><a href={% url 'webtestcase' %} class="nav-link"> WebUI测试 </a></li>
                </ul>
                </li>
                <li class="nav-item">
                    <a href={% url 'parasettings' %} class="nav-link"> 系统设置 </a>
                </li>
                <li class="nav-item">
                    <a href={% url 'user' %} class="nav-link "> 用户管理 </a>
                </li>
                <li class="nav-item" id="cur_product" style="margin-left: 200px">
                    <select id="select-option" name="setInput"  onchange="saveOption()">
                        <option>{{ product_name }}</option>
                        {% for product in product_alls %}
                        <option>
                        {% if product.product_name == product_name %}
                            {{ product.product_name }} ✓
                        {% else %}
                            {{ product.product_name }}
                       {% endif %}
                       </option>
                       {% endfor %}
                    </select>
                </li>
                <li class="nav-item dropdown-user" id="navUser">
                    <a href="#" class="nav-link" id="userName" style="font-size: 13px"></a>
                <ul class="dropdown-menu" id="userDropdownMenu">
                    <li> <a href="https://docs.qq.com/doc/DSVNlZ0xoUWpHYlpx?u=2f0ea49eb4e247f5b3c604c3d58ef026" class="nav-link" style="font-size: 13px" target="_black">使用手册</a></li>
                    <li><a class="nav-link" onclick="logout()" style="font-size: 12px"> 退出 </a></li>
                </ul>
                </li>
            </ul>
        </div>
    </div>

    <br><br><br>
    <div id="outterDiv" class="hk-wrapper screenHeight">
    <div class="container" style="padding: 13px 20px; max-width: 1800px;">
        <div class="row">
        <div class="col-md-7">
            <div class="panel panel-primary">
                <div class="panel-body">
                    <div class="form-group">
                        <div class="row">
                            <div class="col-md-5">
                                <div class="input-group">
                                    <input style="font-size: 12px;height: 35px" type="text" class="form-control" id="key_words_name" placeholder="请输入接口名称或URL"  autocomplete="off">
                                </div>
                            </div>
                            <div class="col-md-2">
                                <button type="button" class="btn btn-primary"
                                        style="text-shadow: black 5px 3px 3px" onclick="search_performance_interface()">查询
                                </button>
                            </div>
                        </div>
                    </div>

                    <div class="table-responsive">
                        <table id="blocks" class="table table-hover">
                            <thead>
                                <tr>
                                    <th style="text-align: left;font-weight: bold;display: none">顺序</th>
                                    <th style="text-align: left;font-weight: bold;">ID</th>
                                    <th style="text-align: left;font-weight: bold;">接口名称</th>
                                    <th style="text-align: left;font-weight: bold;">URL</th>
                                    <th style="text-align: left;font-weight: bold;">产品</th>
                                    <th style="text-align: left;font-weight: bold;">创建人</th>
                                    <th style="text-align: left;font-weight: bold;">选择接口</th>
                                </tr>
                            </thead>

                            <tbody id="tbody">
                            {% for rec in page_list %}
                                <tr>
                                    <td style="width: 30px;white-space: normal;text-align: center;display: none">{{ forloop.counter }}</td>
                                    <td style="width: 20px;text-align: left;" id="ids">{{ rec.id }}</td>
                                    <td style="max-width: 140px;font-size: 12px;white-space: nowrap;overflow: hidden;">{{ rec.name }}</td>
                                    <td style="max-width: 140px;white-space: nowrap;overflow: hidden;font-size: 12px">{{ rec.url }}</td>
                                    <td style="max-width: 100px;white-space: nowrap;overflow: hidden;font-size: 12px">{{ rec.product_id }}</td>
                                    <td style="width:60px;text-align: left;font-size: 12px">{{ rec.charger }}</td>
                                    <td id="operations" style="width: 80px;text-align: center;">
                                        <div class="btn-group btn-group-xs" >
                                            <button type="button" class="btn btn-primary" style="margin-left: 5px" onclick="select_not_login('{{ rec.id }}','{{ rec.name }}','{{ rec.module }}')">选择</button>
                                        </div>
                                    </td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>

                    <div class="container" style="margin-left: 50px">
                        <ul class="pagination" id="pager">
                            {% if page_list.has_previous %}
                                <li class="current"><a href="?page=1">首页</a></li>
                                <li class="previous"><a href="?page={{ page_list.previous_page_number }}">上一页</a></li>
                            {% else %}
                                <li class="previous disabled"><a href="#">上一页</a></li>
                            {% endif %}
                            {% if page_list.has_next %}
                                <li class="next"><a href="?page={{ page_list.next_page_number }}">下一页</a></li>
                                <li class="current"><a href="?page={{  page_list.paginator.num_pages }}">尾页</a></li>
                            {% else %}
                                <li class="next disabled"><a href="#">下一页</a></li>
                            {% endif %}
                            <input type="text" class="form-control" id="page-input" name="page-input" placeholder="输入页码" autocomplete="off" style="display: inline-block;width: 90px">
                            <a href="#" class="#" onclick="jumpToPage()"><span class="badge badge-primary " style="width: 60px;height:30px;font-size: 16px">跳转</span></a>
                            <li><span class="current">第 {{ page_list.number }} / {{ page_list.paginator.num_pages }}页</span></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-5">
            <div class="row">
                            <div class="col-md-1">
                                <button type="button" class="btn btn-danger btn-sm disabled" style="border-radius: 0;" >设置</button>
                            </div>
                            <div class="col-md-5">
                                <div class="input-group" style="margin-left: 9px;">
                                    <span class="input-group-text" style="height: 33px">并发线程数</span>
                                    <input type="text" class="form-control input-sm" style="height: 33px" id="num_bf" placeholder="请输入并发线程数"  autocomplete="off" oninvalid="setCustomValidity('请输入数字');" oninput="setCustomValidity('');" onkeyup="this.value=this.value.replace(/\D/g,'')" value="10">
                                </div>
                            </div>
                            <div class="col-md-4" style="display: none">
                                <div class="input-group">
                                    <span class="input-group-text">次数</span>
                                    <input type="text" class="form-control input-sm" id="num_xh" autocomplete="off" placeholder="0-永远循环" oninvalid="setCustomValidity('请输入数字');" oninput="setCustomValidity('');" onkeyup="this.value=this.value.replace(/\D/g,'')" value="0">
                                </div>
                            </div>
                             <div class="col-md-5">
                                <div class="input-group" style="margin-left: -18px;">
                                    <span class="input-group-text" style="height: 33px">持续时间(分钟)</span>
                                    <input type="text" class="form-control input-sm" style="height: 33px" id="num_sj" autocomplete="off" placeholder="请输入持续压测时间" oninvalid="setCustomValidity('请输入数字');" oninput="setCustomValidity('');" onkeyup="this.value=this.value.replace(/\D/g,'')" value="1">
                                </div>
                            </div>
            </div>

            <br>
             <div class="row" style="display: none">
                 <br>
                            <div class="col-md-1" style="display: none"></div>
                            <div class="col-md-4" style="display: none">
                                <div class="input-group" style="margin-left: 10px">
                                    <span class="input-group-addon">模式</span>
                                        <select class="selectpicker form-control" id="mode" name="mode">
                                        <option>多用户</option>
                                        <option>单用户</option>
                                        </select>
                                </div>
                            </div>
                            <div class="col-md-5" style="display: none">
                                <div class="input-group">
                                    <span class="input-group-addon">cookie</span>
                                    <select class="selectpicker form-control" id="deal_cookie" name="deal_cookie">
                                        <option>不处理</option>
                                        <option>后台生成</option>
                                     </select>
                                </div>
                            </div>
             </div>

             <div class="row">
                 <br>
                 <div class="col-md-12">
                     <button type="button" class="btn btn-danger btn-sm disabled" style="border-radius: 0" >操作</button>
                     <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="" onclick="generate_performance_file()">生成Jmeter文件</button>
                     <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="" onclick="start_test_jmeter()">测试开始</button>
                     <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="" onclick=""> <a style="color: white;" target="current" href="/static/output/index.html">查看结果</a></button>
                     <span style="color: blue;font-weight:bold;font-size:13px;margin-left: 5px;" class="jmeter_status"><progress id="progressBar" value="{{ progress }}" max="{{ progress_total }}"></progress></span>
                 </div>
             </div>

            <div class="row">
                <br>
                <div class="col-md-12" style="display:none;>
                    <div class="panel panel-primary">
                        <div class="panel-heading">
                            <h3 class="panel-title" style="text-align: center">登录接口</h3>
                        </div>
                        <div class="panel-body" id="login_panel"></div>
                    </div>
                </div>
                <div class="col-md-12" style="margin-left: -15px;width: 485px">
                    <div class="panel panel-primary">
                        <div class="panel-heading">
                            <h3 class="panel-title" style="text-align: center">选择的接口列表</h3>
                        </div>
                        <div class="panel-body" id="not_login_panel"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    </div>

</body>
</html>